package com.example.music;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;

public class BindService extends Service {
    public BindService() {
    }

    static class MyBinder extends Binder{
        public void callFun() {
            Log.i("callFun方法被调用", "用户自定义方法");
        }
    }
    @Override
    public IBinder onBind(Intent intent) {
        // TODO: Return the communication channel to the service.
        //throw new UnsupportedOperationException("Not yet implemented");
        Log.i("服务绑定","onBind()方法调用");
        return new MyBinder();
    }

    @Override
    public void onCreate() {
        Log.i("服务创建","onCreate()方法调用");
        super.onCreate();
    }

    @Override
    public boolean onUnbind(Intent intent) {
        Log.i("绑定解除","onUnbind()方法调用");
        return super.onUnbind(intent);
    }
}